{extend name="ashippingmanagement/Public/base" /}
{block name="container"}
    <!-- 标题 -->
    <div class="page-heade">
      <h2 class="title_color text-center">发运数据查询</h2>
    </div>
    <!-- 标题 -->
    <div class="row-margin-top">
    <form id="form_id" action=""  class="form-inline" method="post">
      <table class="row-margin-top tab-content table-bordered  table" border="1">
      	   <tr>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">发运类型</label><span class="helpText" title="注：发运开票金额为0且发运数量不为0的发运数据为搭赠发运。">帮</span></td>
            <td>
				<select name="a.fyType" id="" class="form-control">
					<option value="0">所有发运</option>
					<option value="1">搭赠发运</option>
				</select>
            </td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">分区</label></td>
            <td><input type="text" class="form-control" name="h.title" value="<?php if(isset($where['h_title'])) echo $where['h_title']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">省份</label></td>
            <td><input type="text" class="form-control" name="g.title" value="<?php if(isset($where['g_title'])) echo $where['g_title']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">城市</label></td>
            <td><input type="text" class="form-control" name="f.title" value="<?php if(isset($where['f_title'])) echo $where['f_title']; ?>"></td>
            </tr>
          <tr>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">经销商编号</label></td>
            <td><input type="text" class="form-control" name="b.sn" value="<?php if(isset($where['b_sn'])) echo $where['b_sn']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">经销商名称</label></td>
            <td><input type="text" class="form-control" name="b.title" value="<?php if(isset($where['b_title'])) echo $where['b_title']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">网点编号</label></td>
            <td><input type="text" class="form-control" name="c.sn" value="<?php if(isset($where['c_sn'])) echo $where['c_sn']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">网点名称</label></td>
            <td><input type="text" class="form-control" name="c.title" value="<?php if(isset($where['c_title'])) echo $where['c_title']; ?>"></td>
            </tr>
            <tr>
        	<td style="min-width: 120px;width: 120px"><label for="" class="form-label">品牌</label></td>
            <td><input type="text" class="form-control" name="l.brand_name" value="<?php if(isset($where['l_brand_name'])) echo $where['l_brand_name']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">品类</label></td>
            <td><input type="text" class="form-control" name="k.category_name" value="<?php if(isset($where['k_category_name'])) echo $where['k_category_name']; ?>"></td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label">系列</label></td>
            <td><input type="text" class="form-control" name="j.series_name" value="<?php if(isset($where['j_series_name'])) echo $where['j_series_name']; ?>"></td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label">SKU</label></td>
            <td><input type="text" class="form-control" name="i.sku_name" value="<?php if(isset($where['i_sku_name'])) echo $where['i_sku_name']; ?>"></td>
            </tr>
             <tr>
               <td style="min-width: 120px;width: 120px"><label for="" class="form-label">产品编码</label></td>
            <td><input type="text" class="form-control" name="d.pro_no" value="<?php if(isset($where['d_pro_no'])) echo $where['d_pro_no']; ?>"></td>
            <td style="min-width: 120px;width: 120px"><label for="" class="form-label">产品名称</label></td>
            <td><input type="text" class="form-control" name="d.pro_name" value="<?php if(isset($where['d_pro_name'])) echo $where['d_pro_name']; ?>"></td>
             <td style="min-width: 120px;width: 120px"><label for="" class="form-label">发运日期</label></td>
            <td>
                 <div class="form-group">
            <input type="text" id="start" class="form-control layer-date " style="width: 120px;min-width: 120px; display: inline-block;" name="a.fyDate" value="<?php if(isset($where['a_fyDate'])) echo $where['a_fyDate']; ?>">
           </div>
            <div class="form-group">
                至
            </div>
           <div class="form-group">
            <input type="text" class="form-control layer-date" style="width: 120px;min-width: 120px;display: inline-block;" id="end" name="a.fyDate1" value="<?php if(isset($where['a_fyDate1'])) echo $where['a_fyDate1']; ?>">
           </div>
            </td>
              <td class="text-left" colspan="2">
              <button class="btn btn-info query" type="submit">查询</button>
              <button class="btn btn-info emptyIf" type="submit" onclick="$('#form_id').find('input').val('');">清空</button>
              <button class="btn btn-info LendExcel" type="button" onclick='window.open("/index/Ashippingmanagement/export","_self")'>导出Excel</button>
            </td>
            </tr>
      </table>
      <p class="padding-10">数量合计：<span><?php if(strstr($sumCount['fyNum'],'.')) {echo $sumCount['fyNum'];}else{echo ($sumCount['fyNum']+0).'.00';} ?></span> &nbsp;发运开票金额合计：<span class="ObjectNum"><?php if(strstr($sumCount['fyZheMoney'],'.')) {echo $sumCount['fyZheMoney'];}else{echo ($sumCount['fyZheMoney']+0).'.00';} ?></span></p>
      <table class="table table-striped table-bordered table-hover text-center" id="verifytable">
          <tr class="info text-center">
              <th class="text-center">No.</th>
              <th class="text-center">分区</th>
              <th class="text-center">省份</th>
              <th class="text-center">城市</th>
              <th class="text-center">售达方<br>经销商编号</th>
              <th class="text-center">售达方经销商<br>名称</th>
              <th class="text-center">售达方<br>网点编号</th>
              <th class="text-center">售达方<br>网点名称</th>
              <th class="text-center">产品编码</th>
              <th class="text-center">产品名称</th>
              <th class="text-center">数量</th>
              <th class="text-center">发运<br>基本单位</th>
              <th class="text-center">发运开票金额</th>
              <th class="text-center">毛发运金额</th>
              <th class="text-center">净发运金额</th>
              <th class="text-center">发运日期</th>
              <th class="text-center">订单号</th>
              <th class="text-center">发运单号</th>
              <th class="text-center">批号/批次</th>
              <th class="text-center">备注</th>
              <th class="text-center">销售人员</th>
          </tr>
          <tbody>
          {volist name="data" id="list"}
              <tr>
                  <td>{$i}</td>
                  <td>{$list.qu}</td>
                  <td>{$list.sheng}</td>
                  <td>{$list.shi}</td>
                  <td>{$list.jxsNo}</td>
                  <td>{$list.jxs}</td>
                  <td>{$list.wd}</td>
                  <td>{$list.wdNo}</td>
                  <td>{$list.pro_no}</td>
                  <td>{$list.pro_name}</td>
                  <td class="ObjectNum">{$list.fyNum}</td>
                  <td>{$list.fyBasicUnit}</td>
                  <td class="ObjectNum">{$list.fyZheMoney}</td>
                  <td class="ObjectNum">{$list.fyMaoMoney}</td>
                  <td class="ObjectNum">{$list.fyJingMoney}</td>
                  <td>{$list.fyDate}</td>
                  <td>{$list.orderNumber}</td>
                  <td>{$list.fyONumber}</td>
                  <td>{$list.batchNumber}</td>
                  <td>{$list.des}</td>
                  <td>{$list.em_name}</td>
              </tr>
               {/volist}
          </tbody>
      </table>
      <h5 class="text-center">
            总共有{$sumCount['count']}条记录，第{$page}/{$maxpage}页，当前页：<input id="page" name="pages" type="text" style="width: 70px;" value="" class="form-control" /><button id="gopage" style="height: 23px;">GO</button>&nbsp;&nbsp;<button type="submit" id="fistpage" onclick="$('#form_id').find('input').val('');" style="height: 23px;">首页</button>&nbsp;&nbsp; 每页显示
            <select id="pagesize" style="width: 70px" class="form-control select" name="limts">
            <option value='1'>1</option>
            <option value='5'>5</option>
            <option value='10'>10</option>
          </select>条
        </h5>
        <script>
            $('#pagesize').val("{$limit}");
        </script>

</form>
    </div>
    <script>
        //日期范围限制
        var start = {
            elem: '#start',
            format: 'YYYY/MM/DD',
            min: laydate.now(), //设定最小日期为当前日期
            max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                end.min = datas; //开始日选好后，重置结束日的最小日期
                end.start = datas //将结束日的初始值设定为开始日
            }
        };
        var end = {
            elem: '#end',
            format: 'YYYY/MM/DD',
            min: laydate.now(),
            max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
        $(document).ready(function(){
            // $("#verifytable tbody tr td").find('.duigou')
          /*格式化数字金额*/
          var $ObjectNum =$(".ObjectNum");
             toNum($ObjectNum);
          /*为已生效的核销申请字体加粗*/
            var $duigou =$(".duigou");
             $duigou.parent().addClass("font-bold");

/*设置允许解锁*/
        $("#allowSuo").click(function() {
            // $("#alert_addNewZone").show();
            var $items = $("[name=items]:checkbox")
            if ($items.filter(':checked').length < 1) {
                sweetAlert("", "请选择允许解锁的数据！", "error");
            } else {
              $items.each(function(){ 
              	if( $(this).is(':checked')){
              		 $(this).parent().parent().remove()
              		}
				}); 
            }
        });

/*弹出隐藏的tr*/
          /*table表格操作*/
      $("#checkAll").click(function() {

            $("[name=items]:checkbox").prop("checked", $(this).prop("checked"));
            if ($("[name=items]:checkbox").prop("checked") != true) {
                // console.log($(this))
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#fff")
            } else {
                $("[name=items]:checkbox").parents("tr").css("backgroundColor", "#f8f800")

            }
        })
        $("[name=items]:checkbox").click(function() {
            //定义一个临时变量，避免重复使用同一个选择器选择页面中的元素，提高程序效率
            // console.log(1)
            var $tmp = $("[name=items]:checkbox");
            if ($(this).prop("checked") != true) {
                // console.log($(this))
                $(this).parent().parent().css("backgroundColor", "#fff")
            } else {
                $(this).parent().parent().css("backgroundColor", "#f8f800")

            }
            //用filter()方法筛选出选中的复选框，并直接给CheckedAll赋值
            $("#checkAll").prop('checked', $tmp.length == $tmp.filter(':checked').length);

          })
        })
         
    </script>
{/block}
